package org.cbg.control;

import org.cbg.bean.SearchCollectionResultBean;
import org.cbg.frame.TrslationMainJframe;
import org.cbg.panel.TraslationWantBuyCardJapel;
import org.cbg.until.TraslationTableUntil;
import org.come.action.FromServerAction;
import org.come.until.GsonUtil;

/**
 * 我的收藏阁之收藏信息回调
 * 
 * @author Administrator
 * 
 */
public class SearchCollectionQueryControl implements FromServerAction {

	@Override
	public void controlMessFromServer(String mes, String type) {
		// TODO Auto-generated method stub

		// 消息处理部分转换为SearchGoodsResultBean对象
		SearchCollectionResultBean sa = GsonUtil.getGsonUtil().getgson().fromJson(mes, SearchCollectionResultBean.class);
		TraslationWantBuyCardJapel traslationWantBuyCardJapel = TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel().getTraslationWantBuyJpanel().getTraslationWantBuyCardJapel();
		/**
		 * 当搜索收藏时搜索的结果处理
		 */
		// 处理消息添加到界面
		TraslationTableUntil.setShoucangTableModel(traslationWantBuyCardJapel.getTraslationWantBuyShoucangJpanel().getjScrollPane(), sa.getCollections());
		// 最大页数
		traslationWantBuyCardJapel.getTraslationWantBuyShoucangJpanel().setPage(sa.getTotal() == 0 ? 1 : sa.getTotal());

		/**
		 * 展示收藏面板
		 */
		
		traslationWantBuyCardJapel.getCardLayout().show(traslationWantBuyCardJapel, "shoucang");
	}

}
